package com.gk.javaservice.service.impl;

import com.gk.javaservice.dao.AdminMenuDao;
import com.gk.javaservice.po.AdminMenu;
import com.gk.javaservice.service.AdminMenuService;
import com.gk.javaservice.util.time.TimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminMenuServiceImpl implements AdminMenuService {
    @Autowired
    private AdminMenuDao baseDao;
    @Override
    public void add(AdminMenu adminMenu) {
        String getTime = TimeUtil.dateFormat();
        adminMenu.setCreated_at(getTime);
        adminMenu.setUpdated_at(getTime);
        baseDao.add(adminMenu);
    }

    @Override
    public Integer update(AdminMenu adminMenu) {
        String getTime = TimeUtil.dateFormat();
//        adminMenu.setCreated_at(getTime);
        adminMenu.setUpdated_at(getTime);
        return baseDao.update(adminMenu);
    }

    @Override
    public Integer delete(Object id) {
        return baseDao.delete(id);
    }

    @Override
    public List<AdminMenu> hasAll() {
        return baseDao.hasAll();
    }

    @Override
    public AdminMenu hasById(Object id) {
        return baseDao.hasById(id);
    }
}
